package com.ruoyi.project.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.ruoyi.project.system.domain.UserTaskCompletion;
import com.ruoyi.project.system.mapper.UserTaskCompletionMapper;
import com.ruoyi.project.system.service.IUserTaskCompletionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class UserTaskCompletionServiceImpl implements IUserTaskCompletionService {
    @Autowired
    private UserTaskCompletionMapper userTaskCompletionMapper;

    @Override
    @Transactional
    public UserTaskCompletion selectOne(Wrapper<UserTaskCompletion> queryWrapper) {
        userTaskCompletionMapper.updateOverdueTasks();
        return userTaskCompletionMapper.selectOne(queryWrapper);
    }

    @Override
    @Transactional
    public List<UserTaskCompletion> selectList(Wrapper<UserTaskCompletion> queryWrapper) {
        userTaskCompletionMapper.updateOverdueTasks();
        return userTaskCompletionMapper.selectList(queryWrapper);
    }
}